#### Configuring taosAdapter

Method to configure taosAdapter to receive icinga2 data:

- Enable the configuration item in the taosAdapter configuration file (default location `/etc/taos/taosadapter.toml`)

    ```toml
    # Automatically create the database when writing data with the schemaless feature if set to true.
    smlAutoCreateDB = true
    [opentsdb_telnet]
    enable = true
    maxTCPConnections = 250
    tcpKeepAlive = false
    dbs = ["opentsdb_telnet", "collectd", "icinga2", "tcollector"]
    ports = [6046, 6047, 6048, 6049]
    user = "root"
    password = "taosdata"
    ```

    The default database name written by taosAdapter is `icinga2`, but you can also modify the dbs item in the taosAdapter configuration file to specify a different name. Fill in user and password with the actual TDengine configuration values. taosAdapter needs to be restarted after modifications.

    The `smlAutoCreateDB` configuration item is used to enable the automatic database creation feature. When set to true, taosAdapter will automatically create the corresponding database upon receiving data if it does not already exist.

- You can also use taosAdapter command line parameters or set environment variables to enable taosAdapter to receive icinga2 data, for more details please refer to the taosAdapter reference manual

#### Configuring icinga2

- Enable icinga2's opentsdb-writer ([reference link](https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer))
- Modify the configuration file `/etc/icinga2/features-enabled/opentsdb.conf` filling in `<taosAdapter's host>` with the domain name or IP address of the server running taosAdapter, `<port for icinga2>` with the corresponding port supported by taosAdapter for receiving icinga2 data (default is 6048)

    ```c
    object OpenTsdbWriter "opentsdb" {
      host = "<taosAdapter's host>"
      port = <port for icinga2>
    }
    ```

    Example file:

    ```c
    object OpenTsdbWriter "opentsdb" {
      host = "127.0.0.1"
      port = 6048
    }
    ```
